﻿@using LKVMLMADMIN.Models;
@using PagedList.Mvc;
@using System.Globalization;
@{
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";  
}
@using (Html.BeginForm("Package", "Order", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-inline" }))
{
    <div id="wrapper">
        <div class="row">          
        <h3 class="page-header">Danh sách gói</h3>                       
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel-body">
                    <div class="dataTable_wrapper">
                        <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                            <thead>
                                <tr style="font-family:'Times New Roman'">
                                    <th>STT</th>
                                    <th>Tên gói</th>
                                    <th>Giá thành</th>
                                    <th>Mã số gói</th>
                                    <th>Điểm tích lũy</th>   
                                    <th>Xóa</th>
                                    <th>Sửa</th>                           
                                </tr>
                            </thead>
                            <tbody style="font-family:'Times New Roman'">                              
                                @foreach (var item in ViewBag.Package)
                                {                                  
                                    <tr>                                       
                                        <td>@item.ID</td>
                                        <td>@item.PackageName</td>
                                        <td>@String.Format("{0:0.##}", item.Price)</td>      
                                        <td>@item.PackageCode</td>
                                        <td>@String.Format("{0:0.##}", item.PV)</td>                                                                      
                                        <td><a class="confirmation" href="@Url.Action("Package", "Order", new { id = item.ID })">Delete</a></td>
                                        <td><a  href="@Url.Action("PackageDetail", "Order", new { Pkid = item.ID })">Edit</a></td>
                                    </tr>
                                }
                            </tbody>

                        </table>
                    </div>  
                    <a href="@Url.Action("AddPackage", "Order")" class="btn_submit btn btn-default">Thêm gói</a>    
                    </div>
                   
                </div>
            </div>
        </div>   
    <div class="dataTables_paginate paging_full_numbers pull-right" id="dyntable_paginate">
        @Html.PagedListPager((PagedList.IPagedList)Model, page => Url.Action("Package", new { page, bydate = ViewBag.ByDate }))
    </div> 
    <script type="text/javascript">      
        $('.confirmation').on('click', function () {
            return confirm('bạn có chắc chắn muốn xóa?');
        });
    </script>
    <script>
        $(document).ready(function () {
            $('#dataTables-example').DataTable({
                responsive: true
            });
        });
    </script>
}